package com.xkdx.guangguang.fragment.user;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.apache.http.entity.mime.content.FileBody;

import android.graphics.Bitmap;
import android.os.Environment;

import com.xkdx.guangguang.module.network.AbsAction;

public class UserLoginSinaAction extends AbsAction {

//	Bitmap bim = UserLoginFragment.photo;

	private String sinaWeiboUserID, sinaWeiboToken, sinaWeiboExpireTime,
			userNickName, userSex, userBirthday, userEmail, userMobilePhone,
			deviceSN, deviceModel, oSVersion;

	public UserLoginSinaAction(String sinaWeiboUserID, String sinaWeiboToken,
			String sinaWeiboExpireTime, String userNickName, String userSex,
			String userBirthday, String userEmail, String userMobilePhone,
			String deviceSN, String deviceModel, String oSVersion) {

		this.sinaWeiboUserID = sinaWeiboUserID;
		this.sinaWeiboToken = sinaWeiboToken;
		this.sinaWeiboExpireTime = sinaWeiboExpireTime;
		this.userNickName = userNickName;
		this.userSex = userSex;
		this.userBirthday = userBirthday;
		this.userEmail = userEmail;
		this.userMobilePhone = userMobilePhone;
		this.deviceSN = deviceSN;
		this.deviceModel = deviceModel;
		this.oSVersion = oSVersion;
		key = 3;
		fileBody = new FileBody(new File(Environment.getExternalStorageDirectory() + "/GuangGuang/user/head.jpg"));
	}

	@Override
	public void constructRequest() {
//		bitmap = bim;
		HashMap<String, String> sinaloginmap = new HashMap<String, String>();
		sinaloginmap.put("DeviceID", "2");
		sinaloginmap.put("RegionID", "D0101");
		sinaloginmap.put("SinaWeiboUserID", sinaWeiboUserID);
		sinaloginmap.put("SinaWeiboToken", sinaWeiboToken);
		sinaloginmap.put("sinaWeiboExpireTime", sinaWeiboExpireTime);
		sinaloginmap.put("UserNickName", userNickName);
		sinaloginmap.put("UserSex", userSex);
		sinaloginmap.put("UserBirthday", userBirthday);
		sinaloginmap.put("UserEmail", userEmail);
		sinaloginmap.put("UserMobilePhone", userMobilePhone);
		sinaloginmap.put("DeviceSN", deviceSN);
		sinaloginmap.put("DeviceModel", deviceModel);
		sinaloginmap.put("OSVersion", oSVersion);
		String loginJson = constructJson(sinaloginmap);

		Parameter parameter = new Parameter("userInterface", "sinaWeiboLogin",
				loginJson);
		List<Parameter> list = new ArrayList<Parameter>();
		list.add(parameter);

		requestData = constructMod(list);
	}
}
